<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>success</title>

    <script type="text/javascript" src="../static/jquery-3.2.1.min.js"></script>
</head>

<body>
<div >
    <div>
        恭喜用户<span id="userName"></span>登录成功，port：<span id="port"></span>
    </div>
    <div>
        <span id="sessionId"></span>
    </div>
</div>
</body>

<script>
    $(function(){
        var data = {
            "userName": sessionStorage.getItem("userName"),
            "sessionId": sessionStorage.getItem("sessionId")
        }
        //加载页面时执行校验session方法
        $.ajax({
            type: "post",
            url: "/success",
            data: data,
            dataType: "json",
            success: function (result) {
                if("0"==result.code){
                    alert(result.message);
                    window.location.href = "/static/login.html"
                } else {
                    $("#userName").text(result.data.userName);
                    $("#port").text(result.message);
                    $("#sessionId").text(result.data.sessionId);
                }
            }

        })
    });
</script>

</html>
